package com.ls.mysql.quartz.scheduleTask;

import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MyTask2 extends QuartzJobBean {

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        String time = new SimpleDateFormat("yy-MM-dd HH-mm-ss").format(new Date());
        JobDataMap mergedJobDataMap = jobExecutionContext.getMergedJobDataMap();
        Object invokeParam = mergedJobDataMap.get("invokeParam");
        if (null != invokeParam)
            System.out.println("向任务二传递的参数为==》" + invokeParam);
        System.out.println("任务二执行！------[" + time + "]");
    }
}
